<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="/static/jQuery-3.3.1.js"></script>
    <title>Title</title>
</head>
<body>

<form action="{% url 'add' %}">
    <p>
        加法 <input type="text" name="num1" id="num1">+
        <input type="text" name="num2" id="num2">
    </p>
    <p>结果： <input type="text" id="num" disabled></p>
</form>
<button id="btn">提交</button>

</body>
<script>
    $("#btn").on("click", function () {
        $.ajax({
            url: "{% url 'add' %}",
            type: "post",
            data: {"num1": $("#num1").val(), "num2": $("#num2").val()},
            success: function (data) {
                $("#num").val(data)
            }
        })
    })
</script>
</html>